<template>
  <div>
    <div class="carModelBaseInfo">
      <h4 class="withVerticleLineT4 title14">{{ $t('基本信息') }}</h4>
      <div class="baseInfoItems">
        <full-parent-dom-with-dask :loading="loadingVehicleDetail"></full-parent-dom-with-dask>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('任务名称') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.name||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('批次名称') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.taskGcyExt&&info.taskGcyExt.batchName||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('批次号') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            v-if="info.taskGcyExt"
            :text="info.taskGcyExt&&info.taskGcyExt.batchNo||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('紧急OTA表单编号') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.taskGcyExt&&info.taskGcyExt.gcySerialNo||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('任务类型') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.taskBigType||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('任务状态') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="taskUpdateDictCodeObj[info.status]||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('升级类型') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="$store.getters.getDictCodeObj('upgradeTypeDictCode')[info.upgradeType]||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('OTA升级范围') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.taskGcyExt&&info.taskGcyExt.updateScope||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('生效时间') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.appointTimes&&info.appointTimes.startTime||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('失效时间') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.appointTimes&&info.appointTimes.endTime||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('车辆范围') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.vehicleType||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('ECU升级方式') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          >
            <table-ellipsis v-if="info.isEqualUpgrade" :text="'平刷'"></table-ellipsis>
            <table-ellipsis v-else-if="info.freeBurning==1" :text="'自由烧写'"></table-ellipsis>
            <table-ellipsis v-else-if="info.circleTaskId" :text="'循环升级'"></table-ellipsis>
            <table-ellipsis v-else :text="'常规升级'"></table-ellipsis>
          </a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('源车辆大版本') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="''||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('目标车辆大版本') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="''||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('源智驾域版本') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="''||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('目标智驾域版本') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="''||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('升级策略') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.strategyName||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('备案流程编号') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="''||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('升级原因') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="''||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('供应商验证结论') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.taskGcyExt&&info.taskGcyExt.supplierVerifyConclusion||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('供应商测试报告') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.taskGcyExt&&info.taskGcyExt.supplierTestReport||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('释放单') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.taskGcyExt&&info.taskGcyExt.releaseBill||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('升级准入证明') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.taskGcyExt&&info.taskGcyExt.upgradeAccessProve||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('产品验证结论') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.taskGcyExt&&info.taskGcyExt.productVerifyConclusion||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('产品测试报告') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.taskGcyExt&&info.taskGcyExt.productTestReport||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('创建人') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="info.createBy||'-'"></table-ellipsis></a-col>
        </a-row>
        <a-row class="baseInfoItem">
          <a-col :md="10" :sm="14">{{ $t('创建时间') }}</a-col>
          <a-col
            :md="14"
            :sm="10"
            class="result"
          ><table-ellipsis
            :text="$commonFun.getDateTimeStr(info.createTime) || '-'"></table-ellipsis></a-col>
        </a-row>
      </div>
    </div>
  </div>
</template>
<script>
import FullParentDomWithDask from '@/components/LoadDataSpin/FullParentDomWithDask.vue'
import TableEllipsis from '@/components/Ellipsis/TableEllipsis'
import CustomModal from '@/components/CustomModal/index.vue'
export default {
  components: {
    FullParentDomWithDask,
    CustomModal,
    TableEllipsis
  },
  props: {
    id: {
      type: String,
      default: ''
    }
  },
  watch: {
    id: {
      handler (val) {
        if (val) {
          this.getTaskInfor()
        }
      },
      immediate: true
    }
  },
  computed: {
    taskUpdateDictCodeObj () {
      return this.$store.getters.getDictCodeObj('taskUpdateDictCode')
    }
  },
  created () {
    this.$store.dispatch('getUpgradeTypeDictCodeData')
  },
  mounted () {
  },
  data () {
    return {
      info: {},
      loadingVehicleDetail: false
    }
  },
  methods: {
    getTaskInfor () {
      this.loadingVehicleDetail = true
      this.$api.getTaskInfor({ id: this.id }).then((res) => {
        this.info = res.data
        this.loadingVehicleDetail = false
        this.$emit('getTaskInfo', this.info)
      })
    }
  }
}
</script>
<style lang="less" scoped>
  .vehicle-detail-standalone{
    padding: 24px 37px 0;
    background-color: rgb(249, 249, 249);
    height: 100%;
    overflow: auto;
  }

.carModelBaseInfo {
  margin-bottom: 20px;
  border-bottom: 1px solid @borderColor;
  padding-bottom: 15px;

  .baseInfoItems {
    position: relative;
  }

  .baseInfoItem {
    margin-top: 15px;

    .result {
      text-align: right;
    }
  }
}

.certificateCont {
  border: 1px solid @borderColor;
  border-radius: 2px;
  padding: 10px;
  height: 100%;
  overflow: auto;
  line-height: 2em;
}
</style>
